home *** CD-ROM | disk | FTP | other *** search
/ Delphi 5 for Professionals / DELPHI5.iso / AddOns / Components / RealTime Graphics ActiveX / DATA.3 / Examples / CPP / UITools / UITools.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-10-12  |  4.1 KB  |  153 lines

  1. // UITools.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "UITools.h"
  6.  
  7. #include "MainFrm.h"
  8. #include "UIToolsDoc.h"
  9. #include "UIToolsView.h"
  10.  
  11. #ifdef _DEBUG
  12. #define new DEBUG_NEW
  13. #undef THIS_FILE
  14. static char THIS_FILE[] = __FILE__;
  15. #endif
  16.  
  17. /////////////////////////////////////////////////////////////////////////////
  18. // CUIToolsApp
  19.  
  20. BEGIN_MESSAGE_MAP(CUIToolsApp, CWinApp)
  21.     //{{AFX_MSG_MAP(CUIToolsApp)
  22.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  23.         // NOTE - the ClassWizard will add and remove mapping macros here.
  24.         //    DO NOT EDIT what you see in these blocks of generated code!
  25.     //}}AFX_MSG_MAP
  26.     // Standard file based document commands
  27.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  28.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  29.     // Standard print setup command
  30.     ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  31. END_MESSAGE_MAP()
  32.  
  33. /////////////////////////////////////////////////////////////////////////////
  34. // CUIToolsApp construction
  35.  
  36. CUIToolsApp::CUIToolsApp()
  37. {
  38.     // TODO: add construction code here,
  39.     // Place all significant initialization in InitInstance
  40. }
  41.  
  42. /////////////////////////////////////////////////////////////////////////////
  43. // The one and only CUIToolsApp object
  44.  
  45. CUIToolsApp theApp;
  46.  
  47. /////////////////////////////////////////////////////////////////////////////
  48. // CUIToolsApp initialization
  49.  
  50. BOOL CUIToolsApp::InitInstance()
  51. {
  52.     AfxEnableControlContainer();
  53.  
  54.     // Standard initialization
  55.     // If you are not using these features and wish to reduce the size
  56.     //  of your final executable, you should remove from the following
  57.     //  the specific initialization routines you do not need.
  58.  
  59. #ifdef _AFXDLL
  60.     Enable3dControls();            // Call this when using MFC in a shared DLL
  61. #else
  62.     Enable3dControlsStatic();    // Call this when linking to MFC statically
  63. #endif
  64.  
  65.     // Change the registry key under which our settings are stored.
  66.     // You should modify this string to be something appropriate
  67.     // such as the name of your company or organization.
  68.     SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  69.  
  70.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  71.  
  72.     // Register the application's document templates.  Document templates
  73.     //  serve as the connection between documents, frame windows and views.
  74.  
  75.     CSingleDocTemplate* pDocTemplate;
  76.     pDocTemplate = new CSingleDocTemplate(
  77.         IDR_MAINFRAME,
  78.         RUNTIME_CLASS(CUIToolsDoc),
  79.         RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  80.         RUNTIME_CLASS(CUIToolsView));
  81.     AddDocTemplate(pDocTemplate);
  82.  
  83.     // Parse command line for standard shell commands, DDE, file open
  84.     CCommandLineInfo cmdInfo;
  85.     ParseCommandLine(cmdInfo);
  86.  
  87.     // Dispatch commands specified on the command line
  88.     if (!ProcessShellCommand(cmdInfo))
  89.         return FALSE;
  90.  
  91.     // The one and only window has been initialized, so show and update it.
  92.     m_pMainWnd->ShowWindow(SW_SHOW);
  93.     m_pMainWnd->UpdateWindow();
  94.  
  95.     return TRUE;
  96. }
  97.  
  98. /////////////////////////////////////////////////////////////////////////////
  99. // CAboutDlg dialog used for App About
  100.  
  101. class CAboutDlg : public CDialog
  102. {
  103. public:
  104.     CAboutDlg();
  105.  
  106. // Dialog Data
  107.     //{{AFX_DATA(CAboutDlg)
  108.     enum { IDD = IDD_ABOUTBOX };
  109.     //}}AFX_DATA
  110.  
  111.     // ClassWizard generated virtual function overrides
  112.     //{{AFX_VIRTUAL(CAboutDlg)
  113.     protected:
  114.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  115.     //}}AFX_VIRTUAL
  116.  
  117. // Implementation
  118. protected:
  119.     //{{AFX_MSG(CAboutDlg)
  120.         // No message handlers
  121.     //}}AFX_MSG
  122.     DECLARE_MESSAGE_MAP()
  123. };
  124.  
  125. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  126. {
  127.     //{{AFX_DATA_INIT(CAboutDlg)
  128.     //}}AFX_DATA_INIT
  129. }
  130.  
  131. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  132. {
  133.     CDialog::DoDataExchange(pDX);
  134.     //{{AFX_DATA_MAP(CAboutDlg)
  135.     //}}AFX_DATA_MAP
  136. }
  137.  
  138. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  139.     //{{AFX_MSG_MAP(CAboutDlg)
  140.         // No message handlers
  141.     //}}AFX_MSG_MAP
  142. END_MESSAGE_MAP()
  143.  
  144. // App command to run the dialog
  145. void CUIToolsApp::OnAppAbout()
  146. {
  147.     CAboutDlg aboutDlg;
  148.     aboutDlg.DoModal();
  149. }
  150.  
  151. /////////////////////////////////////////////////////////////////////////////
  152. // CUIToolsApp commands
  153.